package com.geline.easytrans.annotation;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.geline.easytrans.serializer.DictTextSerializer;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 字典翻译注解
 * 使用方式：在 VO 属性上添加
 *      @DictText(value = "sys_sex")
 *      @DictText(value = "sys_sex", target = "sexDesc")
 * @author mx
 * @date 2025/11/8
 */
@JacksonAnnotationsInside
@JsonSerialize(using = DictTextSerializer.class)
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DictText {

    /**
     * 字典类型code
     * @return
     */
    String value();

    /**
     * 生成翻译后新属性名
     * @return
     */
    String target() default "";
}
